<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>添加商品</title>
    <link rel="stylesheet" th:href="@{/css/style.css}"/>
</head>
<body>
<div class="page" id="app">
<div id="mallPage" class=" mallist tmall- page-not-market ">

    <!-- 头部搜索 -->
    <div id="header" class=" header-list-app">
        <div class="headerLayout">
            <div class="headerCon ">
                <!-- Logo-->
                <h1 id="mallLogo">
                    <img th:src="@{/images/jdlogo.png}" alt="">
                </h1>

                <div class="header-extra">

                    <!--搜索-->
                    <div id="mallSearch" class="mall-search">
                        <form name="searchTop" class="mallSearch-form clearfix">
                            <fieldset>
                                <legend>天猫搜索</legend>
                                <div class="mallSearch-input clearfix">
                                    <div class="s-combobox" id="s-combobox-685">
                                        <div class="s-combobox-input-wrap">
                                            <input v-model="keyword" type="text" autocomplete="off" value="dd" id="mq"
                                                   class="s-combobox-input" aria-haspopup="true">
                                        </div>
                                    </div>
                                    <button type="submit" @click.prevent="addkey" id="searchbtn">添加</button>
                                </div>
                            </fieldset>
                        </form>
                        <ul class="relKeyTop">
                            <li><a>秒杀</a></li>
                            <li><a>优惠券</a></li>
                            <li><a>PLUS会员</a></li>
                            <li><a>品牌闪购</a></li>
                            <li><a>拍卖</a></li>
                            <li><a href="add"  target="_blank">添加商品</a></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>

</form>
</div>
</div>
<script th:src="@{/js/axios.min.js}"></script>
<script th:src="@{/js/vue.min.js}"></script>
<script>
    new Vue({
        el:'#app',
        data:{
            keyword:''//搜索的关键字
            ,results:true//搜索的结果
        },
        methods:{
            addkey()
            {
                let keyword=this.keyword
                console.log(keyword);
                //对接后台数据
                axios.get('parse/'+keyword+'').then(response=>{
                    console.log(response);
                    if(response.data==true)
                    {
                        alert("添加成功！")
                    }else {
                        alert("添加异常！")
                    }
                })
            }
        }
    })
</script>
</body>
</html>